/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commands;

import java.io.PrintStream;

/**
 *
 * eCOM - Adopte un Presta - Mars-Avril 2013
 * @author Kheira, Jef, William, Tuan-Long
 */
public class EchoCommand extends CommandAbstract 
{
	public EchoCommand() 
        {
            // Vide.
	}

	@Override
	public String getName() 
        {
            return "echo";
	}

	@Override
	public String getUsage() 
        {
            return "echo <message>";
	}

	@Override
	public String getShortDescription() 
        {
            return "Echo a string";
	}

	@Override
	protected void execute(PrintStream out, PrintStream err) 
        {
            if (dataArguments.isEmpty()) 
            {
                // Rien à afficher.
                err.println("Nothing to echo");
            } 
            else 
            {
                // Affiche le premier argument.
                out.println(dataArguments.getFirst());
            }
	}
}
